#include<iostream>
using namespace std;

int main(){
        int a[]={2,1,15,1,1,10};
        int sleepa=0,a1=a[0],b1=a[1],c1=a[2];
        int sleepb=0,a2 =a[3],b2=a[4],c2=a[5];
        while(c1&&c2){
            if(sleepa) --sleepa;
            else{
                c1 -=a1;
                sleepa =b1; 
            }
            if(sleepb) --sleepb;
            else{
                c2-=a2;
                sleepb = b2;
            }
        }
        if(c1>0) cout<<"B"<<endl;
        if(c2>0) cout<<"A"<<endl;
        if(c1<=0&&c2<=0) cout<<"A&b"<<endl;

}